//package com.juhuixing.es.server.controller;
//
//import com.juhuixing.es.server.constant.ConstParameter;
//import com.juhuixing.common.base.BaseController;
//import com.juhuixing.common.base.ResponseData;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.data.elasticsearch.core.ElasticsearchTemplate;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestParam;
//import org.springframework.web.bind.annotation.RestController;
//
///**
// * @ClassName TestController
// * @Description TODO
// * @Author 刘猛
// * @Date 2019/4/19 10:17
// **/
//@RestController
//@RequestMapping("/operation")
//@Api(tags = "es操作类")
//public class OperationController extends BaseController {
//
//    @Autowired
//    private ElasticsearchTemplate elasticsearchTemplate;
//
//    @ApiOperation("es创建index(相当于mysql database)")
//    @PostMapping("/createIndex")
//    public ResponseData createIndex( @RequestParam String indexName,@RequestParam String className) throws ClassNotFoundException {
//        elasticsearchTemplate.createIndex(indexName);
//        elasticsearchTemplate.putMapping(Class.forName(ConstParameter.ENTITY_PACKAGE_PREFIX +className));
//        return ResponseData.ok("创建成功！");
//    }
//
//    @ApiOperation("es删除索引(相当于删除mysql table)")
//    @PostMapping("/deleteIndex")
//    public ResponseData deleteIndex(@RequestParam String className) throws ClassNotFoundException {
//        return ResponseData.ok(elasticsearchTemplate.deleteIndex(Class.forName(ConstParameter.ENTITY_PACKAGE_PREFIX+className)));
//    }
//
//}
